new to DXL

I am so very new to DXL _. The goal is for user to select number - reset the current number to be 'selected' number.
Problem: user selects number but selected number does not display however, body/text does. i.e. 'selected' number = 15 displayed number = 3307. : (

Any suggestions/direction is appreciated
void goToLien(DBE calledFrom) {
Object o
Object nextObj = next sibling curObj
string ln = get(lNumber)
for o in entire mod do {
lienNum = nextObj."Lien Number"
string sln = lienNum ""
if (sln == ln) {
curObj = nextObj
}
}
description = curObj."Object Text"
comment = curObj."Comments"
set(pDescription, description)
set(probComment, comment)
set(lNumber, ++lienNum "")
}
SystemAdmin - Thu May 19 16:27:06 EDT 2011

Re: new to DXL
rmoskwa - Fri May 20 16:42:43 EDT 2011

I am struggling to understand the goal.

"for user to select number - reset the current number to be 'selected' number."

Is number an attribute that you created? (It is not the AbsoluteNumber or ObjectNumber.)

I am confused as to how the user "selects a number" to replace the number of the currently selected object. Could you elaborate?

Is it possible that you could use an (integer) attribute based on an enumeration type? Clicking on the number-attribute of an object would present a drop-down list box that allows the user to select an enumeration from.

Re: new to DXL
llandale - Tue May 24 12:25:32 EDT 2011

Put "{co de}" without quotes nor the space before and after your code to make it look like this:

void goToLien(DBE calledFrom) {
   Object o
   Object nextObj = next sibling curObj
   string ln = get(lNumber)
   for o in entire mod do {
      lienNum = nextObj."Lien Number"
      string sln = lienNum ""
      if (sln == ln) {
         curObj = nextObj
      }
   }
   description = curObj."Object Text"
   comment = curObj."Comments"
   set(pDescription, description)
   set(probComment, comment)
   set(lNumber, ++lienNum "")
}


Far easier to read. Use the [Preview] tab before posting the message.

It appears the user enters some Lien Number on your dialog and you go to find the object associated with that Lien.

Your "for o in entire mod do" loop looks suspicious, since the code inside your loop does not refer to Object "o". I'm guessing that the two references to "nextObj" inside the loop should really refer to "o"; and I'm guessing that once you find "o" that you should "break" and stop looking. You will also probably want to only consider some of the objects not all of them; almost always a "for o in entire mod" loop is followed by a "if (isDeleted(o)) continue" statement; so you ignore deleted objects. I would also suspect that this function will want to distinquish between the times it finds the "Lien Number" object and when it doesn't.

If we presume that "curObj" is globally defined and points to the currently selected object, then perhaps your code would end up looking like this:

 

void goToLien(DBE calledFrom) {
   Object o, oNew = null
   string ln = get(lNumber)
   for o in entire mod do {
      if (isDeleted(o))               continue // ignore deleted objects
      if (row(o) or table(o))         continue // ignore invisible Table/Row header objects
      if (cell(o))                    continue // ignore table-cell objects
      lienNum = o."Lien Number"
      string sln = lienNum ""
      if (sln == ln) {
         oNew = o              // ** FOUND THE SPECIFIED OBJECT
         break                 // Don't bother to look any further
      }
   }
   if (null oNew)
   {  warningBox("Cannot find specified object #[" lienNum "]")
   }
   else
   {  curObj   = oNew
      description = curObj."Object Text"
      comment = curObj."Comments"
      set(pDescription, description)
      set(probComment, comment)
      set(lNumber, ++lienNum "")
                     // Louie wonders of the following two lines are desirable:
      current = curObj            // Change selected object to the new one
      refresh(module(curObj))     // Redisplay the module so user sees the new object
   }
}


I'm a little miffed about the undeclared variables especially "lienNum". Get in the habit of defining all your variables, in fact turn off "Auto-Declare" as per the DXL manual.

I see you set the dialog to the next Lien Number; guess that's what you want; except the dialog will look confusing displaying the Comments and Description of Lien N, yet also displaying the number N+1. I would just display "N" and have two action buttons, one that gets the displayed Lien N and another that gets the "Next Lien", reads N and adds one.

 

 

 

  • Louie